const path = require('path');
import {BrowserWindow} from 'electron'
import {} from "../ipc/WindowIpc"
import {getMainWindow} from "./MainWindow"

const winIcon = path.join(__dirname, "app/img/64.png")

const options = {
    modal: true,
    title: "vue template",
    icon: winIcon,
    width: 800,
    height: 600,
    // 是否直接显示
    show: false,
    // 背景色
    backgroundColor: '#cccccc'
}

let aboutWindow = null
let url = MAIN_WINDOW_WEBPACK_ENTRY

export const getAboutWindow = () => {
    if (aboutWindow != null) {
        return aboutWindow;
    }
    aboutWindow = new BrowserWindow(options)
    aboutWindow.setParentWindow(getMainWindow())
    aboutWindow.loadURL(url)
    aboutWindow.once('ready-to-show', () => {
        aboutWindow.show()
    })
    aboutWindow.on('closed', () => {
        aboutWindow = null;
    })
    return aboutWindow;
}
